import request from '@/utils/request.js'
// 分类相关
export const getArticleChannels = () => request.get('/my/cate/list')
export const updateArticleChannels = ({ id, cate_name, cate_alias }) => {
  // console.log(id, cate_name, cate_alias)
  return request.put('/my/cate/info', {
    id,
    cate_name,
    cate_alias
  })
}
export const addArticleChannels = ({ cate_name, cate_alias }) =>
  request.post('/my/cate/add', { cate_name, cate_alias })

export const delArticleChannels = (id) => {
  return request.delete('/my/cate/del', { params: { id } })
}
// 文章相关
export const getArticles = (params) => {
  return request.get('/my/article/list', {
    params
  })
}
export const delArticle = (id) =>
  request.delete('/my/article/info', { params: { id } })

// formData格式的对象
export const publishArticle = (data) => request.post('/my/article/add', data)

export const getArticleDetail = (id) =>
  request.get('/my/article/info', { params: { id } })

export const EditArticle = (data) => request.put('/my/article/info', data)
